ποΈGitΠ―ΡΠ°ποΈ
specs/006-kmp-project-structure/data-model.md 4d4070c8e1ed73a56ee2f054300a0f62e3fe2e62 (4d4070c8) Text, 6.86 KB
Data Model: KMP Module Classification & Migration Matrix
Entity: KMP Module
Each KMP module has the following properties relevant to migration:
βββββββββββββββββββββββββββββ¬ββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Field β Type β Description β
βββββββββββββββββββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β T383838path β String β Gradle module path (e.g., T383838:core:common) β
β T383838convention_plugin β Enum β T383838meshtastic.kmp.library or T383838meshtastic.kmp.feature β
β T383838namespace β String? β Android namespace; null = auto-derived by convention β
β T383838namespace_override_needed β Boolean β True if auto-derived namespace doesn't match desired β
β T383838android_resources β Enum β T383838disabled (default), T383838enabled, T383838enabled_with_prefix β
β T383838host_test β Enum β T383838none, T383838empty, T383838with_resources β
β T383838device_test β Boolean β Has T383838withDeviceTest {} block β
β T383838min_sdk_override β Int? β Non-null only if module overrides default minSdk β
β T383838extra_jvm_target β Boolean β Has explicit T383838jvm() call (redundant with convention) β
β T383838jvm_android_source_set β Boolean β Uses T383838meshtastic.kmp.jvm.android plugin β
β T383838tier β Enum β T383838simple, T383838standard, T383838special β
βββββββββββββββββββββββββββββ΄ββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Module Migration Matrix
Tier 1: Minimal β androidLibrary block becomes empty or removed (6 modules)
Modules where convention handles everything. After migration, the T383838kotlin {} block needs no T383838androidLibrary {} at all (namespace auto-derived, resources disabled by convention, no tests).
βββββββββββββββββββββ¬βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β Module β Current `BT383838`Fdddandroid {}`f`b content β After migration β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ€
β T383838core:di β namespace, resources=false β Remove T383838androidLibrary {} entirely β
β T383838core:nfc β namespace, resources=false β Remove T383838androidLibrary {} entirely β
β T383838core:ui β namespace, resources=false β Remove T383838androidLibrary {} entirely β
β T383838core:navigation β namespace only β Remove T383838androidLibrary {} entirely β
β T383838feature:settings β namespace, resources=false β Remove T383838androidLibrary {} entirely β
β T383838feature:messaging β namespace, resources=false β Remove T383838androidLibrary {} entirely β
βββββββββββββββββββββ΄βββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
Tier 2: Standard β only withHostTest remains (18 modules)
Modules that opt into host tests. The T383838androidLibrary {} block only contains T383838withHostTest {}.
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β Module β withHostTest config β After migration β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β T383838core:ble β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:common β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:data β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:domain β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:model β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:network β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:service β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:takserver β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:connections β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:firmware β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:intro β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:map β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:node β T383838{ isIncludeAndroidResources = true } β T383838androidLibrary { withHostTest {β¦ β
β T383838core:datastore β T383838{} (empty) β T383838androidLibrary { withHostTest {β¦ β
β T383838core:prefs β T383838{} (empty) β T383838androidLibrary { withHostTest {β¦ β
β T383838core:repository β T383838{} (empty) β T383838androidLibrary { withHostTest {β¦ β
β T383838core:testing β T383838{} (empty) β T383838androidLibrary { withHostTest {β¦ β
β T383838feature:wifi-provision β T383838{} (empty) β T383838androidLibrary { namespace = "oβ¦ β
ββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ
Tier 3: Special β additional configuration (3 modules)
ββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β Module β Special config β After migration β
ββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββ€
β T383838core:proto β T383838minSdk = 21 β T383838androidLibrary { minSdk = 21 } β
β T383838core:database β namespace + withHostTest + withDeviceTest β T383838androidLibrary { withHostTest { isβ¦ β
β T383838core:resources β resources enabled + prefix + withHostTest β T383838androidLibrary { androidResources β¦ β
ββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββ
Convention Plugin Enhancement
T383838configureKotlinMultiplatform() β new default
T282828
BEFORE (KotlinAndroid.kt:91-101):
compileSdk = ...
minSdk = ...
namespace = auto-derived if null
AFTER:
compileSdk = ...
minSdk = ...
namespace = auto-derived if null
androidResources.enable = false β NEW DEFAULT
This eliminates T383838androidResources.enable = false from 23 of 27 module build files. Only T383838core:resources overrides this to T383838true.
Redundant T383838jvm() cleanup
14 modules declare T383838jvm() in their T383838kotlin {} block despite the convention plugin calling T383838jvm() in T383838configureKotlinMultiplatform(). These redundant declarations will be removed.
Modules with redundant T383838jvm(): T383838core:ble, T383838core:common, T383838core:data, T383838core:database, T383838core:datastore, T383838core:di, T383838core:domain, T383838core:model, T383838core:network, T383838core:resources, T383838core:takserver, T383838core:ui, T383838feature:map, T383838feature:wifi-provision.
State Transitions
T282828
Module State Machine:
[LEGACY] [MIGRATED] [VERIFIED]
android {} inside kotlin {} β androidLibrary {} DSL β Build passes
(or removed if empty)
Each module transitions independently. Build verification after each batch.
Validation Rules
1. No T383838android {} inside T383838kotlin {}: After migration, T383838grep -rn "kotlin {" -A5 | grep "android {" must return zero matches in KMP modules.
2. No redundant T383838jvm(): After cleanup, only convention plugin declares T383838jvm().
3. Namespace correctness: All modules must resolve to correct namespace (verified by successful build).
4. Resources disabled by default: Only T383838core:resources has T383838androidResources.enable = true.
5. Build verification: T383838assembleDebug, T383838:desktop:packageUberJarForCurrentOS, T383838allTests, and T383838DESKTOP_ONLY mode all pass.
Served by rngit 1.5.0 - Generated in 0.06s